package user

import (
	"context"

	commonSdk "github.com/wangzhe1991/grpc-sdk/pb/common"
	userSdk "github.com/wangzhe1991/grpc-sdk/pb/user"

	"gitee.com/krio/grpc-go-server/internal/dependency"
)

type UserService struct {
	userR      dependency.UserRepository
	userLoginR dependency.UserLoginRepository
	userInfoR  dependency.UserInfoRepository
	userEduR   dependency.UserEduRepository
}

func NewUserService(
	uR dependency.UserRepository,
	userLoginR dependency.UserLoginRepository,
	userInfoR dependency.UserInfoRepository,
	userEduR dependency.UserEduRepository,
) *UserService {
	return &UserService{
		userR:      uR,
		userLoginR: userLoginR,
		userInfoR:  userInfoR,
		userEduR:   userEduR,
	}
}

func (u *UserService) Detail(ctx context.Context, userID int32) (*userSdk.UserDetailResp, bool, error) {
	return u.userR.Detail(ctx, userID)
}

func (u *UserService) DetailBySFID(ctx context.Context, userSFID int64) (*userSdk.UserDetailResp, bool, error) {
	return u.userR.DetailBySFID(ctx, userSFID)
}

func (u *UserService) UserAdd(ctx context.Context, req *userSdk.UserCreateReq) (*userSdk.UserCreateResp, error) {
	return u.userR.Add(ctx, req)
}

func (u *UserService) List(ctx context.Context, req *userSdk.UserListReq) (*userSdk.UserListResp, error) {
	return u.userR.List(ctx, req)
}
func (u *UserService) Delete(ctx context.Context, userID int32) (*commonSdk.EmptyResponse, error) {
	return u.userR.Delete(ctx, userID)
}
